<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\SuperTrySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '超值试用';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="super-try-index">
    <p>
        <?= Html::a('新建超值试用', ['create'], ['class' => 'btn btn-success']) ?>&nbsp;&nbsp;&nbsp;
        <?= Html::a('刷新缓存', 'javascript:void(0)', ['id'=>'hc']) ?>
    </p>
    
    
    <div class="box box-success">
        <div class="box-body"><?php echo $this->render('_search', ['model' => $searchModel]); ?></div>
    </div>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'position',
            'product',
            [
            'label'=>'产品名称',
            'value'=> function($data) use (&$dataArray){
                if(!isset($dataArray[$data->product]))return '';
                else return $dataArray[$data->product]['goods_name'];
                }
            ],
            'recommend_time',
            //'add_user',
            // 'add_time',

            ['class' => 'yii\grid\ActionColumn','template'=>'{update}'],
        ],
    ]); ?>
</div>
